
$(document).ready(function() {
    
    $('a').click(function(element){
        
        var url = element.currentTarget.href;
        
        // Get all the parameters from the URL
        var settingsObj = {};
        var attributes = url.split('?');

        if(attributes.length > 0) {
            var parameters = attributes[1].split('&');

            // Place all the parameters in an array
            for(var i in parameters){
                var hash = parameters[i].split('=');
                settingsObj[hash[0]] = hash[1];
            }
        }
        
        if($(this).attr('class').match('.*?openModal.*?')) {
            
            // Prevent the default click action
            element.preventDefault();

            // Create the window
            var window = createModalWindow(url, settingsObj);
            
        }
        
        if($(this).attr('class').match('.*?openForm.*?')) {
            
            // Prevent the default click action
            element.preventDefault();

            // Create the window
            var window = createModalWindow(url, settingsObj);
            
        }
        
        if($(this).attr('class') == 'scrollTo') {
                
            // Prevent the default click action
            element.preventDefault();

            var gotoLocation = 0;

            if(settingsObj.location != 'undefined'){
                var gotoLocation = settingsObj.location;
            } 

            // Scroll to location on the page
            scrollToLocation(gotoLocation);
                
        }
        
    });
    
});

